MyDesktop.FileBrowser = Ext.extend(Ext.app.Module, {

    init : function(){
        this.launcher = {
            text: _('File Browser'),
            iconCls: 'folder',
            handler : this.createWindow,
            windowId : 'FileBrowser',
            scope: this
        }
    },

    createWindow : function(src){
        var desktop = this.app.getDesktop();
        var winname = src.windowId;
        var win = desktop.getWindow(winname);

        if(!win){
			var treepanel = new Ext.ux.FileTreePanel({
				height:400,
				autoWidth:true,
				id:'ftp',
				rootPath:'root',
				topMenu:false,
				autoScroll:true,
				url: getMainUrl(),
				rootVisible: false,
				loadMask: true,
				enableRename: false,
				enableUpload: false,
				enableProgress: false,
				enableNewDir: false,
				enableDelete: false,
				enableDD: false,
				enableOpen: false,
				rootPath: "#ROOT",
				downloadUrl: getMainUrl("action=download"),
				baseParams:{action: 'filebrowser'}
			});        	
/*        	
            var tree = new Ext.tree.TreePanel({
                animate:true, 
                autoScroll:true,
                useArrows: true,
		        loader: new Ext.tree.TreeLoader({
		            dataUrl:getMainUrl('action=profile_manager'),
		        }),
                containerScroll: true,
                rootVisible: false,
		        root: new Ext.tree.AsyncTreeNode({
		            id:'id'
		        }),
		        region: 'north',
		        split: true,
		        height: 220
            });
*/
            win = desktop.createWindow({
				id: winname,
				closable:true,
				width:640,
				height:480,
				plain:true,
				layout: 'fit',
				iconCls: src.iconCls,
				items: treepanel,
				title: src.text
            });
            
        }
        win.show();

    },
    
	display : function(){
        this.createWindow();
	}
});